﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace WaiGaoQiaoWeb.Models
{
    public class ArticleVM
    {
        /// <summary>
        /// Id
        /// </summary>
        public int ID { get; set; }
        /// <summary>
        /// 物品编号
        /// </summary>
        [DisplayName("物资编号")]
        public string ArticleNO { get; set; }
        /// <summary>
        /// 物质名称
        /// </summary>
        [DisplayName("物资名称")]
        [Required(ErrorMessage = "物品名称不能为空")]
        public string ArticleName { get; set; }
        /// <summary>
        /// 物品规格
        /// </summary>
        [DisplayName("物资规格")]
        public string ArticleUnit { get; set; }
        IList<string> unitList;
        /// <summary>
        /// 规格列表
        /// </summary>
        public IList<string> UnitList
        {
            get
            {
                if (string.IsNullOrEmpty(ArticleUnit))
                {
                    return unitList;
                }
                else
                {
                    return ArticleUnit.Split(',').ToList();
                }
            }
            set
            {
                unitList = value;
                ArticleUnit = string.Join(",", value);
            }
        }
        /// <summary>
        /// 组织机构
        /// </summary>
          [DisplayName("组织机构")]
        public int PriorId { get; set; }
        /// <summary>
        /// 领用类型
        /// </summary>
         [DisplayName("领取类型")]
        public int GetType { get; set; }
         /// <summary>
         /// 物资颜色
         /// </summary>
         [DisplayName("物资颜色")]
         public string Color { get; set; }
    }
}